package cn.chencaiju.algorithm;

import org.junit.Test;

public class ReSequence {
	public boolean containsNearbyDuplicate(int[] nums, int k) {
		int end=nums.length;
		int max=0;
		for(int i=0;i<end-1;i++) {
			for(int j=i+1;j<end;j++) {
				if(nums[i]==nums[j]) {
					if(max<Math.abs(i-j)) {
						max=Math.abs(i-j);
					}
				}
			}
		}
		return max==k;        
    }
	@Test public void test() {
		int[] nums= {99,99};
		System.out.println(containsNearbyDuplicate(nums,2));
	}
}
